﻿/*
 * LdAddRequest
 * 
 * initial implementation : 26.6.2013
 *
 * Copyright (c) Adam Sida, asida@centrum.cz.
 * All rights reserved.
 * 
 * for license see cz.uhul.DSMLv2.txt
 */
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;


namespace cz.uhul.DSMLv2
{



  /// <summary>
  /// The System.DirectoryServices.Protocols.LdAddRequest class adds an entry to
  /// the directory.
  /// </summary>
  //[XmlType(TypeName = "addRequest")]
  //[XmlInclude(typeof(LdAttr))]
  public class LdAddRequest : LdDnRequest
  {




    public LdAddRequest()
      :base()
    {
      Attributes = new LdAttrCollection();
    }




    /// <summary>
    /// retrieves only objectClass attributes
    /// </summary>
    [XmlIgnore]
    public List<string> ObjectClass
    {
      get
      {
        List<string> tmp = new List<string>();

        //last objectclass is superior
        foreach(LdAttr a in this.Attributes)
          if(a.Name.ToLower() == "objectclass")
            tmp.Add(a.Values[0].ToString());

        return tmp;
      }
    }






    /// <summary>
    /// The LdmodifyRequest.Attributes property contains
    /// a LdAttrCollection of attribute-value
    /// pairs for the object.
    /// </summary>
    [XmlElement(ElementName = "attr", Order = 1, Form = XmlSchemaForm.None, IsNullable = false)]
    public LdAttrCollection Attributes { get; set; }




  }

}